<?php
//informacion de los combos
header("Content-Type: text/html;charset=utf-8");
include("db_config.php");


	$db_conection=mysql_connect("localhost","root","busters7");
	mysql_select_db("gecime",$db_conection);
	
	
    $especialidadid = !empty($_GET['id'])
              ?intval($_GET['id']):0;
    
     
    $query = "SELECT * FROM medicos WHERE especialidad = '".$especialidadid."'"; 
    
    
    $result = mysql_query($query);
    $items = array();
    if($result && mysql_num_rows($result)>0) 
    {
        while($row = mysql_fetch_array($result)) 
        {
            $option = array(
            "id" => $row[0], 
            "value" => htmlentities($row[4])." ".htmlentities($row[3]));
            $items[] = $option;
        }        
    }
    mysql_close();
    $data = json_encode($items);
    $response = isset($_GET['callback'])?$_GET['callback']."(".$data.")":$data;
    echo($response);  

?>
